package c.x.jy.wexin.controller;

import c.x.jy.common.utils.PageUtils;
import c.x.jy.common.utils.R;
import c.x.jy.dao.entity.ServiceEntity;
import c.x.jy.service.service.ServiceService;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Arrays;
import java.util.List;
import java.util.Map;


/**
 * 复杂问题服务项目表
 *
 * @author amwhyh
 * @email xxx@xx.com
 * @date 2021-05-24 16:59:18
 */
@RestController
@RequestMapping("wechat/service")
public class ServiceController {
    @Autowired
    private ServiceService serviceService;

    /**
     * 列表
     */
    @RequestMapping("/list")
    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = serviceService.queryPage(params);

        return R.put(page);
    }

    /**
     * 列表
     */
    @RequestMapping("/alllist")
    public R alllist(Integer inTop ){
        QueryWrapper<ServiceEntity> query = new QueryWrapper<>();
        if(inTop!=null){
            query.lambda().eq(ServiceEntity::getInTop,inTop);
        }
        List list = serviceService.list(query);

        return R.put(list);
    }

    /**
     * 信息
     */
    @RequestMapping("/info/{id}")

    public R info(@PathVariable("id") Long id){
		ServiceEntity service = serviceService.getById(id);

        return R.put(service);
    }



}

